"""
    工件类
"""
from PyPixelCore.group.BaseGroup import BaseGroup

class WorkPiece:
    def __init__(self, *some_piece, run_func=None):
        self.group = BaseGroup()
        self.add_group(some_piece)
        self.else_run_func = run_func

    def add_group(self, *some_piece):
        self.group.add(some_piece)

    def hide(self):
        for each_piece in self.group:
            each_piece.is_show = False

    def show(self):
        for each_piece in self.group:
            each_piece.is_show = True

    def run(self, aim_panel):
        if self.else_run_func is not None:
            self.else_run_func(self, aim_panel)
            return
        for each_piece in self.group:
            aim_panel.add_sprites(each_piece)
    def kill(self):
        for each_piece in self.group:
            each_piece.kill()